#!/bin/bash
# must export BL31 env, refer to board/sunxi/README.sunxi64
if [[ -z $BL31 ]];then
    echo 'please set BL31 envoriment'
    exit 0
fi
make distclean && make nanopi_neo2_defconfig && make -j4
if [[ -n $1 ]];then
    dd if=$1/spl/sunxi-spl.bin of=/dev/sdd bs=1k seek=8
    dd if=$1/u-boot.itb of=/dev/sdd bs=1k seek=40
    sync
fi
